package com.droowa.model.dao;

import java.sql.SQLException;

import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.droowa.domain.MileageOption;

@Repository
public class MileageOptionDAOMybatisImpl implements MileageOptionDAO{

	@Autowired
	private SqlSessionTemplate session;
	
	@Override
	public int insertMileageOption(MileageOption mileageOption)
			throws SQLException {
		return session.insert(makeSqlId("insertMileageOption"), mileageOption);
	}

	@Override
	public int deleteMileageOption() throws SQLException {
		return session.delete(makeSqlId("deleteMileageOption"));
	}

	@Override
	public int updateMileageOption(MileageOption mileageOption)
			throws SQLException {
		return session.update(makeSqlId("updateMileageOption"), mileageOption);
	}

	@Override
	public MileageOption selectMileageOption() throws SQLException {
		return session.selectOne(makeSqlId("selectMileageOption"));
	}

	private String makeSqlId(String id){
		return "droowa.MileageOption."+id;
	}
	
}
